<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>系统管理后台</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/app.css">
    <style>
        .admin-container {
            display: flex;
            min-height: 100vh;
        }

        .admin-sidebar {
            width: 200px;
            background: #2f4050;
        }

        .admin-content {
            flex: 1;
            padding: 20px;
            background: #f5f5f5;
        }

        .admin-logo {
            height: 60px;
            line-height: 60px;
            text-align: center;
            color: white;
            font-size: 18px;
            border-bottom: 1px solid #293846;
        }

        .admin-nav .layui-nav-item a {
            color: #a7b1c2;
        }

        .admin-nav .layui-nav-itemed>a,
        .admin-nav .layui-nav-tree .layui-nav-child a {
            color: #a7b1c2;
        }

        .admin-nav .layui-this a {
            color: white;
            background: #293846;
        }

        .admin-header {
            background: white;
            padding: 0 20px;
            height: 60px;
            line-height: 60px;
            border-bottom: 1px solid #e6e6e6;
        }

        .admin-main {
            margin-top: 20px;
        }

        .current-time {
            color: #666;
            font-size: 14px;
        }
    </style>
</head>

<body>
    <div class="admin-container">
        <!-- 侧边栏导航 -->
        <div class="admin-sidebar">
            <div class="admin-logo">系统管理后台</div>
            <ul class="layui-nav layui-nav-tree admin-nav" lay-filter="admin-nav">
                <li class="layui-nav-item layui-this">
                    <a href="javascript:;" data-url="/admin/dashboard">控制台</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="/admin/user-management">用户管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="/admin/session-management">会话管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="/admin/project-management">项目管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="/admin/system-stats">系统统计</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" id="logout-btn">退出</a>
                </li>
            </ul>
        </div>

        <!-- 主内容区 -->
        <div class="admin-content">
            <div class="admin-header">
                <span class="current-time" id="currentTime"></span>
            </div>
            <div class="admin-main">
                <iframe id="adminFrame" src="/admin/dashboard" frameborder="0"
                    style="width: 100%; height: calc(100vh - 100px);"></iframe>
            </div>
        </div>
    </div>

    <script src="/js/config/api.js"></script>
    <script src="/js/http.js"></script>
    <script src="/js/auth-utils.js"></script>
    <script src="/layui/layui.js"></script>
    <script src="/js/utils.js"></script>
    <script>
        layui.use(['element', 'jquery'], function () {
            var element = layui.element;
            var $ = layui.$;

            var bsm_utils = layui.utils;

            // 导航菜单点击事件
            element.on('nav(admin-nav)', function (elem) {
                var url = $(elem).data('url');
                if (url) {
                    $('#adminFrame').attr('src', url);
                }
            });

            // 更新时间
            function updateCurrentTime() {
                var now = new Date();
                var timeString = now.toLocaleString('zh-CN', {
                    year: 'numeric',
                    month: '2-digit',
                    day: '2-digit',
                    hour: '2-digit',
                    minute: '2-digit',
                    second: '2-digit',
                    hour12: false
                });
                $('#currentTime').text('当前时间: ' + timeString);
            }

            // 退出登录
            document.getElementById('logout-btn').addEventListener('click', function () {
                layui.bsm_utils.logOut();
            });

            updateCurrentTime();
            setInterval(updateCurrentTime, 1000);

        });
    </script>
</body>

</html>